package com.guigu.erp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.erp.mapper.DesignProcedureMapper;
import com.guigu.erp.pojo.DesignProcedure;
import com.guigu.erp.service.DesignProcedureService;
import com.guigu.erp.utils.PageUtils;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @author Lenovo
 */
@Service
public class DesignProcedureServiceImpl extends ServiceImpl<DesignProcedureMapper, DesignProcedure>
        implements DesignProcedureService {

    @Override
    public PageUtils<DesignProcedure> DesignProcedurePage( int pageNo, int pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        List<DesignProcedure> designProcedureList = this.list();
        PageInfo<DesignProcedure> pageInfo = new PageInfo<>(designProcedureList);

        System.out.println("pageInfo = " + pageInfo);
        // PageInfo 转换成 PageUtils
        PageUtils<DesignProcedure> pageUtils = new PageUtils<>();
        pageUtils.setRows(pageInfo.getList());
        pageUtils.setTotal(pageInfo.getTotal());
        return pageUtils;
    }
}
